<div class="clr-row" style="padding-left: 20px">
  <div class="clr-row flex-items-xs-between flex-items-xs-top" style="padding-left: 15px; padding-right: 15px;">
    <h3 class="header-title">{{'PVC.CREATE_TMP' | translate}}</h3>
  </div>
  <form [formGroup]="currentForm" clrForm clrLayout="horizontal" style="width: 100%;">
    <wayne-box class="form-block wrap">
      <div class="clr-form-control clr-row" *ngIf="clusters" formArrayName="clusters">
        <label class="clr-control-label required">{{'TITLE.CLUSTER' | translate}}</label>
        <span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'PVC.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
        <div class="clr-control-container clr-col-md-10 clr-col-12">
          <div class="clr-checkbox-wrapper" style="display: inline-block;" *ngFor="let cluster of clusters;let i=index"
            [formGroupName]="i">
            <input formControlName="checked" class="clr-checkbox" type="checkbox" id="{{cluster.id}}-check">
            <label for="{{cluster.id}}-check">{{cluster.name}}</label>
          </div>
        </div>
      </div>
      <clr-textarea-container>
        <label class="required">{{'TEMPLATE.RELEASE_EXPLAIN' | translate}}</label>
        <textarea clrTextarea formControlName="description" rows="3" style="width: 65%" required>
                      </textarea>
        <clr-control-error>description is required</clr-control-error>
      </clr-textarea-container>
      <clr-input-container>
        <label class="required">{{'PVC.CONTAINER_NUM' | translate}}</label>
        <input type="number" clrInput required formControlName="storage" [placeholder]="'PVC.CONTAINER_NUM' | translate">
        <clr-control-helper>单位 G</clr-control-helper>
      </clr-input-container>
      <div class="clr-form-control clr-row">
        <label class="clr-control-label required">{{'PVC.ACCESS_PATTERN' | translate}}</label>
        <div class="clr-control-container clr-col-md-10 clr-col-12">
          <clr-checkbox-wrapper>
            <input type="checkbox" formControlName="readWriteOnce" clrCheckbox name="readWriteOnce" value="readWriteOnce" />
            <label>ReadWriteOnce</label>
          </clr-checkbox-wrapper>
          <clr-checkbox-wrapper>
            <input type="checkbox" formControlName="readOnlyMany" clrCheckbox name="readOnlyMany" value="readOnlyMany" />
            <label>ReadOnlyMany</label>
          </clr-checkbox-wrapper>
          <clr-checkbox-wrapper>
            <input type="checkbox" formControlName="readWriteMany" clrCheckbox name="readWriteMany" value="readWriteMany" />
            <label>ReadWriteMany</label>
          </clr-checkbox-wrapper>
        </div>
      </div>
      <label class="label-level2">关联标签
        <button (click)="onAddSelector()" style="margin-left: 10px;" class="wayne-button primary">
          <clr-icon shape="add-text"></clr-icon>
          添加</button>
      </label>
      <ng-container formArrayName="selectors">
        <div class="clr-form-control clr-row" *ngFor="let selector of selectors.controls; let i = index" [formGroupName]="i">
          <label class="clr-control-label required">{{'PVC.ASSOCIATED_LABEL' | translate}}</label>
          <div class="clr-control-container clr-col-md-10 clr-col-12">
            <div class="clr-input-wrapper">
              <input type="text" class="clr-input" style="width: 300px;" formControlName="key" required [placeholder]="'PLACEHOLDER.SELECTOR_NAME' | translate">
              <input type="text" class="clr-input" formControlName="value" required [placeholder]="'PLACEHOLDER.SELECTOR_VALUE' | translate" style="margin-left: 15px;width: 300px;">
              <a href="javascript:void(0)">
                <clr-icon (click)="onDeleteSelector(i)" shape="trash" [title]="'PVC.DELETE_LABEL' | translate" class="is-solid clr-icon"></clr-icon>
              </a>
              <a href="javascript:void(0)">
                <clr-icon (click)="onAddSelector()" shape="plus-circle" [title]="'PVC.ADD_LABEL' | translate" class="is-solid clr-icon"></clr-icon>
              </a>
            </div>
          </div>
        </div>
      </ng-container>
    </wayne-box>
    <div class="clr-wizard-footer-buttons tpl-bottom" [style.top.px]="top">
      <button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
      <button type="button" class="btn btn-primary"
              (click)="openModal()">{{'BUTTON.ADVANCED_CONFIG' | translate}}</button>
      <button type="button" class="btn btn-primary" [disabled]="!isValid"
              (click)="onSubmit()">{{'BUTTON.SUBMIT' | translate}}</button>
    </div>
  </form>
</div>
<wayne-ace-editor (outputObj)="savePvcTpl($event)"></wayne-ace-editor>
